<template>
    <li @click="handleClick">
        {{ item }}
    </li>
</template>

<script>
export default {
    props:['item'],
    inject:['navTitle','app'],    //使用inject
    data(){
        return {

        }
    },
    methods:{
        handleClick(){
            console.log(this.item,this.navTitle);
            console.log();
            this.app.navTitle = this.item;  //将item的值赋值给app组件的navTitle
        }
    }
}
</script>

<style>

</style>